package com.xiaotu.yapi.controller;

import com.xiaotu.yapi.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.WebApplicationContext;

/**
 * 分类名称
 * 分类备注/描述
 *
 * @author Mr.zhang
 * @module yapi
 * @date 2022-01-19 20:54
 */
@RestController
@Scope(scopeName = WebApplicationContext.SCOPE_REQUEST)
//@Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DemoController {

    private int num = 0;

    @Autowired
    private DemoService demoService;

    @GetMapping("getNum")
    public String getNum() {
        num++;
        return "num = " + num;
    }

    @GetMapping("getAbc")
    public String getAbc() {
        return "abc = " + demoService.getAbc();
    }

    @GetMapping("getDef")
    public String getDef() {
        return "def = " + demoService.getDef();
    }

}
